const jsonwebtoken = require('jsonwebtoken')
const secret = 'assembleteamJWT'

const JWT = {
  generate: (value, time) => { //time 有效期
    return jsonwebtoken.sign(value, secret, {expiresIn:time})
  },
  verify:(token)=> { // 解密 token校验
    try{
      return jsonwebtoken.verify(token,secret) 
    }catch(e){
      // console.log(e);
      return false
    }
  }
}
module.exports = JWT